import request from '@/utils/request'
import { authAPiUrl, organizationApiUrl, commonApiUrl } from '@/api/config.js'
import request2 from '@/utils/request2'

export function getResourceList(params) {
    return request({
        url: authAPiUrl + '/res/load/parentid',
        method: 'get',
        params
    })
}

export function getSystemInfos(params) {
    return request({
        url: 'ycloud-devmanage/systemInfo/findSystemInfos',
        method: 'get',
        params
    })
}

export function addResource(data) {
    return request({
        url: authAPiUrl + '/res/save',
        method: 'post',
        data
    })
}

export function updateResource(data) {
    return request({
        url: authAPiUrl + '/res/update?status=old',
        method: 'post',
        data
    })
}

export function delResource(params) {
    return request({
        url: authAPiUrl + '/res/remove',
        method: 'POST',
        params
    })
}

export function getResourceDetail(params) {
    return request({
        url: authAPiUrl + `/res/load/desensitize/id`,
        method: 'get',
        params,
        unNotify: true,
        unReject: true
    })
}

/**
 * 获取业务标识
 */
export function getBusinessCode(params) {
    return request({
      url: authAPiUrl + '/role/command/list',
      method: 'get',
      params
    })
  }

  /**
   * 查询组织下员工信息
   */
  export function getEmployeesList(data) {
      return request2({
          url: organizationApiUrl + '/employees/pages',
          method: 'post',
          data
      })
  }

  /**
   * 根据用户Id获取签字信息
   */
  export function getSignInfoByUser(params) {
      return request({
          url: commonApiUrl + '/signature/by-user',
          method: 'get',
          params
      })
  }

  /**
   * 新增签字信息
   */
  export function addSignInfo({params, data}) {
      return request({
          url: commonApiUrl + '/signature',
          method: 'post',
          params,
          data
      })
  }

    /**
   * 编辑签字信息
   */
  export function updateSignInfo({params, data}) {
    return request({
        url: commonApiUrl + '/signature/update',
        method: 'post',
        params: params,
        data
    })
}

    /**
   * 编辑签字信息
   */
     export function deleteSignInfo(data) {
        return request({
            url: commonApiUrl + '/signature/by-id',
            method: 'post',
            data
        })
    }

/**
 * 获取指定用户的角色列表
 */
export function getRoleListByUser(params) {
    return request({
        url: authAPiUrl + '/role/authorized/clientId',
        method: 'get',
        params
    })
}


/**
 * 通过组织id去查岗位
 */
export function getJobListByOrg(params) {
    return request({
        url: organizationApiUrl + '/posts/list-by-org',
        method: 'get',
        params
    })
}